package luogu;

import java.io.*;
import java.util.StringTokenizer;

public class Main12712 {
    public static void main(String[] args) throws IOException {
        // 高效输入输出流
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));

        // 读取第一行数据
        StringTokenizer st = new StringTokenizer(br.readLine());
        int n = Integer.parseInt(st.nextToken());
        int m = Integer.parseInt(st.nextToken());

        int[] count = new int[n + 1];  // 计数数组

        // 读取选票数据
        st = new StringTokenizer(br.readLine());
        for (int i = 0; i < m; i++) {
            int number = Integer.parseInt(st.nextToken());
            count[number]++;
        }

        // 高效输出
        StringBuilder sb = new StringBuilder();
        for (int i = 1; i <= n; i++) {
            String numStr = String.valueOf(i);
            for (int j = 0; j < count[i]; j++) {
                sb.append(numStr).append(" ");
            }
        }

        // 删除最后一个多余空格
        if (sb.length() > 0) {
            sb.setLength(sb.length() - 1);
        }

        bw.write(sb.toString());
        bw.flush();
    }
}
